﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication3
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

            RangeValidator1.MaximumValue = DateTime.Now.ToShortDateString();


            if (TextBox1.Text=="admin")
            {
                Label1.Text = "账户名禁止使用 admin！";
            }
            else
            {
                Label1.Text = "";
            }
        }

       

        protected void RangeValidator1_DataBinding(object sender, EventArgs e)
        {
            
        }

        protected void RangeValidator2_DataBinding(object sender, EventArgs e)
        {
           
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            if (FileUpload1.HasFile == true)
            {
                string fileName = FileUpload1.FileName;

                if (fileName.EndsWith(".jpg") || fileName.EndsWith(".png") || fileName.EndsWith(".gif"))
                {
                    string url = Server.MapPath(@"~\img\" + fileName);
                    FileUpload1.SaveAs(url);
                    Image1.ImageUrl = @"~/img/" + fileName;
                }
                else
                {
                    Literal1.Text = "文件格式不正确！";
                }
            }
            else
            {
                Literal1.Text = "不能上传空文件！";
                return;
            }

            if (Page.IsValid)
            {
                Literal2.Text = "注册成功！<a href='/WebForm2.aspx/'>点击跳转登录页面</a> ";
            }
        }

        protected void FileUpload1_DataBinding(object sender, EventArgs e)
        {
           


        }
    }
}